//
//  EncryptedCell.m
//  iHealthEHR
//
//  Created by Joseph Ayo Akinyele on 5/26/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "EncryptedCell.h"


@implementation EncryptedCell
@synthesize entry_title, myIndex, myTarget, theFunction;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        // Initialization code
    }
    return self;
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {

    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(IBAction) viewPolicyButton:(id) sender
{
	printf("Index: %i\n", myIndex);
	
	// DetailedViewController *dvc = (DetailedViewController *) myTarget;
	if([myTarget respondsToSelector:@selector(viewABEpolicy:)]) {
		NSLog(@"Viewing ABE policy");
		[myTarget performSelector:@selector(viewABEpolicy:) withObject:(id)myIndex];
	}
}

-(IBAction) decryptCCRButton:(id) sender
{
	printf("Index: %i\n", myIndex);
	if([myTarget respondsToSelector:theFunction]) {
		/* make sure we dont get run-time error */
		NSLog(@"Decrypt record for: %@", myTarget);
		[myTarget performSelector:theFunction withObject:(id)myIndex];
	}
}

- (void)dealloc {
	[entry_title release];
    [super dealloc];
}


@end
